home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 12 / Cream of the Crop 12 (Part II) / Cream of the Crop 12 (Part II).iso / OS2 / V15N04.ZIP / WARPCA.ZIP / WCABSRC.ZIP / SELFILES.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-18  |  1.6 KB  |  67 lines

  1. // DSelFilesDlg -- Class implementation
  2. #include <assert.h>
  3. #include <cstring.h>
  4. #include <dir.h>
  5. #include <classlib\arrays.h>
  6. #include <owl\owlpch.h>
  7. #include <owl\dialog.h>
  8. #include <owl\edit.h>
  9. #include <owl\static.h>
  10. #include <owl\button.h>
  11. #include "os2api.h"
  12. #include "resource.h"
  13. #include "selfiles.h"
  14.  
  15. #define DID_OK      1
  16. #define DID_CANCEL  2
  17.  
  18. DEFINE_RESPONSE_TABLE1(DSelFilesDlg, TDialog)
  19.     EV_CHILD_NOTIFY(IDC_FILE_MASK, EN_CHANGE, OnFileMaskBoxChange),
  20.     EV_CHILD_NOTIFY(DID_OK, BN_CLICKED, CmOk),
  21.     EV_CHILD_NOTIFY(IDC_DESELECT, BN_CLICKED, CmDeselect),
  22. END_RESPONSE_TABLE;
  23.  
  24. void DSelFilesDlg::SetupWindow()
  25. {
  26.     TDialog::SetupWindow();
  27.  
  28.     // If confirm all, then other checkboxes are disabled.
  29.     SetDlgItemText(IDC_FILE_MASK, szOldFileMask);
  30.  
  31.     int cc = strlen(szOldFileMask);
  32.     WinEnableWindow(GetDlgItem(DID_OK), cc);
  33. }
  34.  
  35. void DSelFilesDlg::OnFileMaskBoxChange()
  36. {
  37.     // Enable or disable OK button based on whether file mask box is empty.
  38.     int cc = WinQueryWindowTextLength(GetDlgItem(IDC_FILE_MASK));
  39.     WinEnableWindow(GetDlgItem(DID_OK), cc);
  40.     WinEnableWindow(GetDlgItem(IDC_DESELECT), cc);
  41. }
  42.  
  43. void DSelFilesDlg::CmOk()
  44. {
  45.     // Retrieve new settings and write them back to parent's data.
  46.     char szTemp[80];
  47.  
  48.     GetDlgItemText(IDC_FILE_MASK, szTemp, 80);
  49.     strcpy(lpszOldFileMask, szTemp);
  50.  
  51.     CloseWindow(TRUE);
  52. }
  53.  
  54. void DSelFilesDlg::CmDeselect()
  55. {
  56.     // Retrieve new settings and write them back to parent's data.
  57.     char szTemp[80];
  58.  
  59.     GetDlgItemText(IDC_FILE_MASK, szTemp, 80);
  60.     strcpy(lpszOldFileMask, szTemp);
  61.  
  62.     CloseWindow(-5);  // Return code for deselecting.
  63. }
  64.  
  65.  
  66.  
  67.